using MvvmIService.Services;
using MvvmIService.ViewModels;

namespace MvvmIService; 

public class ServiceLocator {
    private IServiceProvider _serviceProvider;

    public MainPageViewModel MainPageViewModel =>
        _serviceProvider.GetService<MainPageViewModel>();

    public ServiceLocator() {
        var services = new ServiceCollection();
        services.AddSingleton<MainPageViewModel>();
        services.AddSingleton<ITokenService, TokenService>();
        _serviceProvider = services.BuildServiceProvider();
    }
}